package main

import (
	"fmt"
	"os/exec"
)

func uploadCopies(filenames []string) error {
	for _, filename := range filenames {
		scpcmd := fmt.Sprintf("sshpass -p %s %s %s %s@%s:%s", APP.BakHostSFTPPwd, APP.ScpBin, filename, APP.BakHostSFTPUsername, APP.BakHost, APP.BakHostWorkdir)
		cmd := exec.Command("sh", "-c", scpcmd)
		if err := cmd.Run(); err != nil {
			return fmt.Errorf("上传到scp服务器失败: %w，命令：%s", err, cmd.String())
		}
	}
	return nil
}
